package ${controllerPackage};

import com.liaoyifan.core.annotation.TagOrder;
import ${baseControllerName};
import com.liaoyifan.core.model.Page;
import com.liaoyifan.core.valid.groups.Opera;
import ${converterPackage}.${converterName};
import ${dtoPackage}.${dtoName};
import ${entityPackage}.${entityName};
import ${queryPackage}.${queryName};
import ${servicePackage}.${serviceName};
import ${voPackage}.${voName};
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * ${tableComment}
 *
 * @author ${author}
 * @since ${since}
 */
@Tag(name = "${tableComment}")
@TagOrder(${tagOrder})
@Validated
@RestController
@RequestMapping("/${controllerUrl}")
public class ${controllerName} extends ${baseControllerSimpleName}<${entityName}, ${serviceName}, ${converterName}> {

    @Operation(summary = "分页")
    @GetMapping("/page")
    @Validated(Opera.Page.class)
    public Page<${voName}> page(@Valid ${queryName} query) {
        return super.service.page(query);
    }

    @Operation(summary = "新增")
    @PostMapping("/insert")
    @Validated(Opera.Insert.class)
    public void insert(@RequestBody @Valid ${dtoName} param) {
        super.service.insert(param);
    }

    @Operation(summary = "修改")
    @PostMapping("/update")
    @Validated(Opera.Update.class)
    public void update(@RequestBody @Valid ${dtoName} param) {
        super.service.update(param);
    }

    @Operation(summary = "删除")
    @PostMapping("/delete")
    @Validated(Opera.Delete.class)
    public void delete(@RequestBody @Valid ${dtoName} param) {
        super.service.delete(param);
    }
}
